<style>
    .layui-btn{
        margin-top: 10px;
    }

    .goods-stock{
        width: 80px;
        display: inline;
    }

    .spec-item .layui-form-checkbox{
        margin-top: 0 !important;
    }
    .new-spec{
        display: inline-block;
        width: 100px;
    }

    .extend-goods-cat>.layui-btn{
        margin-top: 3px;
        margin-right: 5px;
    }
    .extend-goods-cat>.layui-btn,.extend-goods-cat>.layui-form-select{
        float: left;
    }

</style>
<div id="spec_form" class="section">

<div id="spec_select" style="display: none">
    {if condition="$customSpec"}
        {volist name="spec" id="vo"}
            <div class="layui-form-item" pane>
                <label class="layui-form-label">{$vo.name}</label>
                <div class="layui-input-block">
                    {volist name="vo.specValue" id="v"}
                    <div class="spec-item layui-input-inline">
                        <input type="checkbox" name="spec[{$vo.name}][{$v.id}]" value="{$v.value}" lay-skin="primary"  lay-filter="spec_select" class="spec-select">
                        <input type="text" value="{$v.value}" name="row[new_spec][{$v.id}][]" class="layui-input new-spec ">
                    </div>
                    {/volist}
                </div>
            </div>
        {/volist}
    {else}
        {volist name="spec" id="vo"}
            <div class="layui-form-item" pane>
                <label class="layui-form-label" style="padding: 0 !important;">{$vo.name}</label>
                <div class="layui-input-block">
                    {volist name="vo.specValue" id="v"}
                    <input type="checkbox" name="spec[{$vo.name}][]" value="{$v.value}" lay-skin="primary" title="{$v.value}" lay-filter="spec_select"> {$v.value}&nbsp
                    {/volist}
                </div>
            </div>
        {/volist}
    {/if}

    <div class="layui-form-item">
        <div class="layui-input-inline">
            <input type="hidden" value="{$typeInfo.id}" name="type_id">
            <button class="layui-btn layui-btn-sm generate-spec">{:__('Generate Spec')}</button>

        </div>

    </div>

    <div id="more_spec">

    </div>

</div>
<div id="no_spec">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><span class="required">* </span>{:__('Price')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" min="0" value="0.00" type="number">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Costprice')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-costprice" class="form-control" step="0.01" name="row[costprice]" min="0" value="0.00" type="number">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Mktprice')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-mktprice" class="form-control" step="0.01" name="row[mktprice]" min="0" value="0.00" type="number">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Sn')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-sn" class="form-control" name="row[sn]" placeholder="{:__('Please enter the SN')}" maxlength="30" type="text">
        </div>
        {:__('Auto generate without fillin')}
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Stock')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-stock" class="form-control" name="row[stock]" type="number" value="0">
        </div>
        {:__('Positive add stock,Negative decrease stock')}
    </div>



</div>
</div>

{if condition="$canOpenSpec eq 'true' "}
<div class="layui-form-item">
    <label class="layui-form-label" >{:__('Open Spec')}：</label>
    <div class="layui-input-inline">
        <button type="button" class="layui-btn layui-btn-sm" id="open_spec" is_open="false" lay-filter="open_spec" data-id="{$typeInfo.id}" style="margin-top:5px;">{:__('Open')}</button>
    </div>
    <div class="layui-form-mid layui-word-aux">
        {:__('The specification value cannot contain "," and ":"')}
    </div>
</div>
{/if}
{notempty name="typeParams"}
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"><legend>{:__('Goods Params')}</legend></fieldset>
{volist name="typeParams" id="vo"}
<div class="form-group">

    <label class="control-label col-xs-12 col-sm-2">{$vo.name}:</label>
    <div class="col-xs-12 col-sm-8">
        {if condition="$vo.type eq 'text'"}
        <input type="text" name="row[params][{$vo.name}]"  class="form-control">
        {elseif condition="$vo.type eq 'checkbox'"/}
        <div class="checkbox">
        {volist name="$vo.value" id="params"}
            <label>
                <input type="checkbox" name="row[params][{$vo.name}][{$params}]" lay-skin="primary" title="{$params}"> {$params}&nbsp
            </label>
        {/volist}
        </div>
        {elseif condition="$vo.type eq 'radio'"/}
        <div class="raido" style="padding: 5px;">
        {volist name="$vo.value" id="params" key="p"}
            <label>
                <input type="radio" name="row[params][{$vo.name}]" value="{$params}" title="{$params}" {if condition="$p eq 1"}checked{/if}> {$params}&nbsp
            </label>
        {/volist}
        </div>
        {/if}
    </div>

</div>
{/volist}
{/notempty}
<!--<script>
    layui.use('form', function(){
        layui.form.render();
        $("body").on("input propertychange",'.new-spec',function(){
            var value = $(this).val();
            var specCheckbox = $(this).parent('.spec-item').find(".spec-select");
            specCheckbox.val(value);
        });
    });
</script>-->
